package com.jshan.controller;

import com.jshan.common.annotation.OperationLog;
import com.jshan.utils.DashboardUtils;
import com.jshan.base.vo.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

@Tag(name = "仪表盘接口")
@RestController
@RequestMapping("/dashboard")
@RequiredArgsConstructor
public class DashboardController {

    private final DashboardUtils dashboardUtils;

    @Operation(summary = "首页顶部展示信息")
    @GetMapping("/top")
    public Result dasTop() {
        return dashboardUtils.findTopList();
    }

    @Operation(summary = "首页统计图数据")
    @GetMapping("/charts")
    @OperationLog("近一周访问记录")
    public Result dasChars() {
        return dashboardUtils.findWeekChars();
    }

    @GetMapping("/phyInfo")
    @OperationLog("获取机器物理信息")
    public Result phyInfo() {
        return dashboardUtils.phyInfo();
    }
}
